<?php

/**
 * Subclass for representing a row from the 'zdonline' table.
 *
 * 
 *
 * @package plugins.zdOnlinePlugin.lib.model
 */ 
class Online extends BaseOnline
{
	
	public static function isonline($id)
	
	 {
	 	$c = new Criteria();
	 	$c->add(zdOnlinePeer::USER_ID,$id);
	 	$cnt=zdOnlinePeer::doCount($c);
	 	if($cnt==0){ return false; }
	 	else
	 	{
	 		$ol=zdOnlinePeer::doSelectOne($c);
	 		if($ol->getBlock()==true){ return false; }
	 		$time = sfConfig::get('app_time_online',5)*60;
	 		if($ol->getTime()>time()-$time)
	 		{
	 		return true;	
	 		}
	 		else
	 		{
	 		return false; 	
	 		}
	 	}
	 	
	 }
	
}
